from flask import render_template, request

from ..modle import TPassage
from . import blueprint as main
from flask import url_for


@main.route("/", methods=['GET', 'POST'])
def index():
    page = request.args.get('page', 1, type=int)
    pagination = TPassage.query.paginate(page, per_page=5, error_out=False)
    passage_info = pagination.items
    return render_template("homemodel.html", passage_info=passage_info,
                           pagination=pagination, endpoint='main.index')


@main.route("/homepage")
def home():
    return render_template("homemodel.html")
